<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="org.cache.AccountService" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.context.support.ClassPathXmlApplicationContext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
ApplicationContext context = new ClassPathXmlApplicationContext( 
        "applicationContext.xml");// 加载 spring 配置文件
    
     AccountService s = (AccountService) context.getBean("accountService"); 
     // 第一次查询，应该走数据库
     System.out.print("first query..."); 
     s.getAccountByName("somebody"); 
     // 第二次查询，应该不查数据库，直接返回缓存的值
     System.out.print("second query..."); 
     s.getAccountByName("somebody"); 
     System.out.println(); 
%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>